{extend  name="manage@public/layout" /}
{block name="content"}
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>出款列表</h5>
                        <!-- {/eq} -->
                        <div class="ibox-tools">
                            <a class="collapse-link" onclick="location.replace(location.href);">
                                <i class="fa fa-refresh"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="table-responsive">
                            <!--- 搜索--->
                            <form action="" method="post">
                                <div class="col-sm-2 col-sm-on">
                                    <select name="status" class="input-sm form-control input-s-sm inline">
                                        <option selected value="0">出款状态</option>
                                        <option {notempty name="data['status']"}{eq name="data['status']" value="1"}selected{/eq}{/notempty} value="1">处理中</option>
                                        <option {notempty name="data['status']"}{eq name="data['status']" value="2"}selected{/eq}{/notempty} value="2">成功,已打款</option>
                                        <option {notempty name="data['status']"}{eq name="data['status']" value="3"}selected{/eq}{/notempty} value="3">失败,已退款</option>
                                    </select>
                                </div>
                                <div class="col-sm-2 col-sm-on" >
                                    <input type="text" value="{notempty name="data['keyword']"}{$data['keyword']|trim}{/notempty}" name="keyword" placeholder="商户号" class="input-sm form-control">
                                </div>
                                <div class="col-sm-4 col-sm-on col-sm-auto">
                                    <input style="width:155px;cursor:not-allowed;" placeholder="开始日期" class="input-sm form-control form-control layer-date" name="start" value="{empty name="data['start']"}<?php echo date('Y-m-d 00:00:00',time());?>{else/}{$data.start}{/empty}" readonly id="start"><i style="position: relative;top:5px;">&nbsp;-&nbsp;</i>
                                    <input style="width:155px;cursor:not-allowed;" placeholder="结束日期" class="input-sm form-control form-control layer-date" name="end" value="{empty name="data['end']"}<?php echo date('Y-m-d 23:59:59',time());?>{else/}{$data.end}{/empty}" readonly id="end">
                                </div>
                                <div class="col-sm-1 col-sm-botton">
                                    <div class="input-group">
                                        <button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-search"></i></button>
                                    </div>
                                </div>
                                <div class="col-sm-1 col-sm-botton">
                                    <div class="input-group">
                                        <button title="导出" type="submit" name="order_export" value="export" class="btn btn-sm btn-primary"><i class="fa fa-download"></i></button>
                                    </div>
                                </div>
                            </form>
                            <!--- end --->
                            <table style="width:1700px;" class="table table-striped table-bordered table-hover ">
                                <thead>
                                    <tr>
                                        <th>ID</th>
                                        <th style="width:100px;">订单号</th>
                                        {neq name="admin_auth['role_id']" value="2"}
                                        <th>商户号</th>
                                        <th>角色</th>
                                        <th>商户名称</th>
                                        {/neq}
                                        {neq name="admin_auth['role_id']" value="2"}
                                        <th style="width:100px;">出款渠道</th>
                                        {/neq}
                                        <th>锁定账号</th>
                                        <th>状态</th>
                                        <th>操作</th>
                                        <th>手续费</th>
                                        <th>申请金额</th>
                                        <th>实际到账</th>
                                        <th>开户人</th>
                                        <th>银行卡号</th>
                                        <th>所属银行</th>
                                        <th>所在支行</th>
                                        <th>开卡城市</th>
                                        <th>申请时间</th>
                                        <th>备注</th>
                                        
                                    </tr>
                                </thead>
                                <tbody>
                                    {volist name="list" id="vo"}
                                    <tr>
                                        <td>{$vo.id}</td>
                                        <td>{$vo.with_out_no}</td>
                                        {neq name="admin_auth['role_id']" value="2"}
                                        <td>{$vo.mch_id}</td>
                                        <td>{eq name="vo['type']" value="2"}<small style="color: red;">代理商</small>{else/}商户{/eq}</td>
                                        <td>
                                            {:\\app\\model\\Mch::getMch($vo.mch_id)}
                                        </td>
                                        {/neq}
                                        {neq name="admin_auth['role_id']" value="2"}
                                        <td><input onblur="remark_chan({$vo.id})"  {in name="vo.status" value='3,4'} disabled {/in} type="text" class="input-sm form-control" name="channel" id="chan_{$vo.id}" value="{$vo.channel|default=''}" /></td>
                                        {/neq}
                                        <td>{$vo.lock_name|default=''}</td>
                                        <td>
                                            {eq name="admin_auth['role_id']" value="2"}
                                            {switch vo.status }
                                            {case 1|2}<small style="color:#1c84c6;">处理中</small>{/case}
                                            {case 3}<small style="color:#23b313;">已打款</small>{/case}
                                            {default /}<small style="color:red;">失败,已退款</small>
                                            {/switch}
                                            {else/}
                                            {switch vo.status }
                                            {case 1 }未处理{/case}
                                            {case 2}<small style="color:#1c84c6;">处理中</small>{/case}
                                            {case 3}<small style="color:#23b313;">已打款</small>{/case}
                                            {default /}<small style="color:red;">失败,已退款</small>
                                            {/switch}
                                            {/eq}
                                        </td>
                                        <td style="width:195px;">
                                            {in name="vo.status" value='3,4'}
                                            <span class="btn btn-sm btn-white"> <i class="fa fa-ban">&nbsp;暂无操作</i> </span>
                                            {else/}  
                                            {eq name="admin_auth['role_id']" value="2"}
                                            <span class="btn btn-sm btn-white"> <i class="fa fa-ban">&nbsp;暂无操作</i> </span>
                                            {else/}
                                            {eq name="vo.lock" value="1"}
                                            <button style="color: #1c84c6;border: 1px solid #1c84c6;" onclick="is_lock({$vo.id},2)" type="button" class="btn btn-sm bt-w btn-white"><i class="fa fa-check-circle">&nbsp;锁定</i></button>
                                            {else/}
                                            <button style="color: #e07a0b;border: 1px solid #e07a0b;" onclick="is_lock({$vo.id},1)" type="button" class="btn btn-sm bt-w btn-white"><i class="fa fa-times">&nbsp;解除</i></button>
                                            <button style="color: #1ab394;border: 1px solid #1ab394;" onclick="out_amount({$vo.id})" type="button" class="btn btn-sm bt-w btn-white"><i class="fa fa-check-circle">&nbsp;出款</i></button>
                                            {/eq}
                                            <button style="color: red;border: 1px solid red;" onclick="turn_down({$vo.id})" type="button" class="btn btn-sm btn-white"><i class="fa fa-ban">&nbsp;拒绝</i></button>
                                            {/eq}{/in}
                                        </td>
                                        <td>{$vo.poundage}</td>
                                        <td>{$vo.total_fee|abs|default=''}</td>
                                        <td style="color: red;">{$vo.actual_fee|abs|default=''}</td>
                                        <td>{$vo.account_name}</td>
                                        <td>{$vo.card_number}</td>
                                        <td>{$vo.bank_name}</td>
                                        <td>{$vo.branch}</td>
                                        <td>{$vo.location}</td>
                                        <td>{$vo.create_time}</td>
                                        <td>{$vo.remark}</td>
                                    </tr>
                                    {/volist}
                                </tbody>
                            </table>
                            <div style="float:right;" class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
                                {$page|raw}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div> 
   
    <!-- 弹框 --->
    <div id="modal-demo-no" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content radius">
                <div class="modal-header">
                    <h3 class="modal-title">拒绝出款理由</h3>
                    <a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a>
                </div>
                <input type="hidden" id="wid" name="wid" value="0" />
                <div class="modal-body" style="padding: 40px 100px !important;">
                    <div class="form-group">
                        <textarea id="remark" class="input-sm form-control" rows="5" cols="30" style="border: 1px solid #e5e6e7;" placeholder="输入拒绝理由" name="remark"></textarea>
                    </div>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-primary no_submit">确定</button>
                    <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
                </div>
            </div>
        </div>
    </div>
    <!--  end --->
    <input type='hidden' name="st_start" value="<?php echo date('Y-m-d 00:00:00',strtotime('-7 days'))?>" />
<input type='hidden' name="st_end" value="<?php echo date('Y-m-d 23:59:59',time());?>" />
{/block}
{block name="script"}
<script src="/static/js/admin/with.js?v=1.1"></script>
<script src="/static/layer/layer.js"></script>
<script>
   //时间插件
   var start = {
        elem:"#start",
        format:"YYYY-MM-DD hh:mm:ss",
        min:$("input[name='st_start']").val(),
        max:$("input[name='st_end']").val(),
        istime:true,
    };
    var end = {
        elem:"#end",
        format:"YYYY-MM-DD hh:mm:ss",
        min:$("input[name='st_start']").val(),
        max:$("input[name='st_end']").val(),
        istime:true,
    };
    laydate(start);laydate(end);
    function turn_down(id) {
        $("#wid").val(id);
        $("#modal-demo-no").modal("show");
    }
    
    function remark_chan(id){
        name = $("#chan_"+id).val();
        $.post("/manage/chanEdit",{id:id,name:name},function(result){
            parent.layer.msg(result.msg);
            if(result.code != 1){
                setTimeout(function() {
                    window.location.reload();
                }, 1000)
            }
        })
    }
    //锁定/解除
    function is_lock(id,type){
        parent.layer.confirm('确认操作吗？', {
            btn: ['确认','取消'], //按钮
            shade: false //不显示遮罩
        }, function(){
            $.post('/manage/wit_is_lock',{id:id,type:type},function(result){
                parent.layer.msg(result.msg);
                if(result.code == 1){
                    setTimeout(function() {
                        window.location.reload();
                    }, 1000)
                }
            });
        }, function(){
            parent.layer.msg('操作取消');
        });
    }
</script>
{/block}

